<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .container{
            width: 500px;
            margin: 100px auto;
            padding: 20px;
        }
        .box {
            width: 100px;
            height: 100px;
            background-color: rgb(241, 199, 199);
        }
        .higher{
            height: 200px;
        }
        .widther{
            width: 200px;
        }
    </style>
</head>
<body>
    <div class="container">

    
    <div class="btn-wrap">
        <button id="w" class="btn">变宽</button>
        <button id="h" class="btn">变高</button>
        <button class="btn"></button>
        <button class="btn"></button>
        <button class="btn"></button>
    </div>
    <div class="box"></div>
</div>
<script>
    const wBtn = document.querySelector('#w')
    const hBtn = document.querySelector('#h')
    const box = document.querySelector('.box')
    wBtn.onclick = function(){
        // box.style.width = "200px"
        // box.classList.add("widther")
        box.classList.toggle('widther')
        
    }
    hBtn.onclick = function(){
        // box.style.height = "200px"
        box.classList.add("higher")
    }
</script>
</body>
</html>